﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Arbalest.Web.Services
{
    public class ModelStateService : IModelStateService
    {
        private ModelStateDictionary ModelState {get;set;}

        public ModelStateService (ModelStateDictionary modelState)
        {
            this.ModelState = modelState;
        }

        #region IModelStateService Members

        public void AddError(string key, string errorMessage)
        {
            this.ModelState.AddModelError(key, errorMessage);
        }

        public void AddError(string key, Exception exception)
        {
            this.ModelState.AddModelError(key, exception);
        }

        public bool IsValid
        {
            get { return this.ModelState.IsValid; }
        }

        #endregion
    }
}